#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>

#include <iostream>
using namespace std;

#define MAXSIZE 50
typedef int KeyType;

typedef  struct
{
    KeyType  key;
} ElemType;

typedef  struct
{
    ElemType* R;
    int  length;
} SSTable;

void  Create(SSTable& T)
{
    int i;
    T.R = new ElemType[MAXSIZE + 1];
    cin >> T.length;
    for (i = 1; i <= T.length; i++)
        cin >> T.R[i].key;
}

int  Search_Bin(SSTable T, KeyType k);

//int main()
//{
//    SSTable T;  KeyType k;
//    Create(T);
//    cin >> k;
//    int pos = Search_Bin(T, k);
//    if (pos == 0) cout << "NOT FOUND" << endl;
//    else cout << pos << endl;
//    return 0;
//}


int  Search_Bin(SSTable T, KeyType k) {
    int left = 1;
    int right = T.length;
    while (left <= right) {
        int mid = left + (right - left) / 2;
        if (T.R[mid].key > k) right = mid - 1;
        else if (T.R[mid].key < k) left = mid + 1;
        else if (T.R[mid].key == k)return mid;
    }
    return 0;
}

//int main()
//{
//    float Open, High, Low, Close;
//    scanf("%f %f %f %f", &Open, &High, &Low, &Close);
//    if (Close < Open)
//    {
//        printf("BW-Solid");
//    }
//    else if (Close > Open)
//    {
//        printf("R-Hollow");
//    }
//    else
//    {
//        printf("R-Cross");
//    }
//
//
//    if (Low<Open && Low<Close && High>Open && High>Close)
//    {
//        printf(" with Lower Shadow and Upper Shadow");
//    }
//    else if (Low < Open && Low < Close)
//    {
//        printf(" with Lower Shadow");
//    }
//    else if (High > Open && High > Close)
//    {
//        printf(" with Upper Shadow");
//    }
//    return 0;
//}


int main() {
    int n;
    scanf("%d", &n);
    int* arr;
    arr = (int*)malloc(n*sizeof(int));
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &arr[i]);
    }
    for (int i = 1; i < n - 1; i++)
    {
        if (arr[0] > arr[1] && arr[i] && arr[i] < arr[i + 1])
        {
            printf("unsorted");
            return 0;
        }
        else if (arr[0]<arr[1] && arr[i] && arr[i]>arr[i + 1])
        {
            printf("unsorted");
            return 0;
        }
    }
    printf("sorted");
    return 0;
}